from SCons.Script import Environment,SConscript,AddOption,GetOption
import sys
import os

AddOption('--test',dest='test',type='string',help='测试那个模块')

# 强制使用GCC工具链配置
env = Environment(
    tools=['gcc', 'g++', 'gnulink']
)

env['ENV']['PATH'] = os.environ['PATH']
env['CFLAGS'] = '-Iinclude -g'

objs = SConscript('can/Sconscript',exports='env',variant_dir='build/can',duplicate=0)
objs += SConscript('src/Sconscript',exports='env',variant_dir='build/src',duplicate=0)

if GetOption('test') != 'none':
    test = GetOption('test')
    objs += SConscript('test/Sconscript',exports=['env','test'],variant_dir='build/test',duplicate=0)
    env.Program('test', objs)

